<?php

class Images {

    const IMG_HEADER = 'logo_sirh.png';
    const IMG_FOOTER = 'logo_sirh_only.png';
    const IMG_LOCK = 'cadena.png';
    // Menu principal
    const IMG_MENU_FORMATION = 'bouton_formations.png';
    const IMG_MENU_EAI = 'bouton_entretiens.png';
    const IMG_MENU_ACCUEIL = 'bouton_accueil.png';
    const IMG_MENU_EMPLOIS = 'bouton_emplois.png';
    const IMG_MENU_REMU = 'bouton_remunerations.png';
    const IMG_MENU_NOTES = 'bouton_notes.png';

}

/* * ***********************************************************************
  nom           :   Graphic User Interface
  version       :   1.0
  autheur       :   pma
  date          :   01/12/2012
  description   :   Cette librairie contient toutes les fonctions inérantes aux affichages graphiques
 * *********************************************************************** */
//============================================================================
// TYPE ICON
//============================================================================
$ICON_VISUALISATION = 3;
$ICON_UPDATE = 4;
$ICON_DELETE = 5;
$ICON_VALIDATION = 6;
$ICON_ADD = 7;
$ICON_PDF = 8;
$ICON_UNLOCKED = 9;
$ICON_NEW_PDF = 10;
$ICON_PREVIOUS = 11;
$ICON_NEXT = 12;
$ICON_FIRST = 13;
$ICON_LAST = 14;
$ICON_SAVE = 15;
$ICON_QUIT = 16;
$ICON_REFRESH = 17;
$ICON_CSV = 18;

/* ================================================================================================
 * 
 */

function gui_top_page($param_1) {
    echo "<!DOCTYPE html>";
    echo "<html lang=\"fr\" xmlns=\"http://www.w3.org/1999/xhtml\">";
    echo "\n<head>";
    echo "\n	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />";
    echo "\n	<title>" . Strings::LABEL_0001 . "</title>";

    gui_include_jqueryui($param_1);

    echo '<div id="loader"></div>';
    echo "\n<script>";
    echo "\n	function stop_load_img()";
    echo "\n	{  ";
    echo "\n        document.getElementById(\"loading\").style.display = \"none\";";
    echo "\n	}";
    echo "\n	function load_img()";
    echo "\n	{  ";
    echo "\n        document.getElementById(\"loading\").style.display = \"inline\";";
    echo "\n	}";
    echo "\n </script>";

    echo "\n</head>";
    echo "\n<body onLoad=\"stop_load_img();\">";

    require_once 'Twig/Autoloader.php';
    Twig_Autoloader::register();
    $loader = new Twig_Loader_Filesystem('app/views/templates');
    $twig = new Twig_Environment($loader);

    global $PAGE_0004;
    $PAGE = $PAGE_0004;

    // OBSOLETE

    require 'app/views/shared/header.php';
}

function gui_include_jqueryui($param_1) {

    GLOBAL $PATH_CSS, $PATH_JS;

    echo "\n	<link type=\"text/css\" href=\"" . $PATH_CSS . "ui/jquery-ui-1.8.21.custom.css\" rel=\"stylesheet\" />";
    echo "\n	<link type=\"text/css\" href=\"" . $PATH_CSS . "sirh-consulting.css\" rel=\"stylesheet\" />";
    echo "\n	<script type=\"text/javascript\" src=\"" . $PATH_JS . "jquery-1.7.2.min.js\"></script>";
    echo "\n	<script type=\"text/javascript\" src=\"" . $PATH_JS . "jquery-ui-1.8.20.custom.min.js\"></script>";
    echo "\n	<script type=\"text/javascript\" src=\"" . $PATH_JS . "toolkit.js\"></script>";

    echo "\n	<script type=\"text/javascript\">";

    echo "\n		$(document).ready(function() {";

    //hover states on the static widgets
    echo "\n			$('#dialog_link, ul#icons li').hover(";
    echo "\n				function() { $(this).addClass('ui-state-hover'); },";
    echo "\n				function() { $(this).removeClass('ui-state-hover'); }";
    echo "\n			);";

    gui_jqueryui_dialog_confirmation_eai();
    gui_jqueryui_dialog_del_eai();
    gui_jqueryui_dialog_del_eai_by_manager($param_1);
    gui_jqueryui_dialog_raz_eai();
    gui_jqueryui_dialog_confirmation_campaign();

    echo "\n$('button').button();";

    echo "\n$('#tabs').tabs();";

    gui_include_jqueryui_accordion_eai_user();
    gui_include_jqueryui_accordion_eai_manager();
    gui_include_jqueryui_accordion_eai_hr_expert();
    gui_include_jqueryui_accordion_eai_admin();
    gui_include_jqueryui_datepicker("datepicker_creation_eai");
    gui_include_jqueryui_datepicker("datepicker_objectif_eai_1");
    gui_include_jqueryui_datepicker("datepicker_objectif_eai_2");
    gui_include_jqueryui_datepicker("datepicker_objectif_eai_3");
    gui_include_jqueryui_datepicker("datepicker_objectif_eai_4");
    gui_include_jqueryui_datepicker("datepicker_objectif_eai_5");

    echo "\n		});";
    echo "\n	</script>";
}

/* ================================================================================================
  fonction               :   gui_jqueryui_dialog_confirmation_eai
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_jqueryui_dialog_confirmation_eai() {
    // Création de Dialog (type confirmation) pour la validation d'un EAI par un évluateur
    echo "\n$('#dialog_eai_valid').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0029 . "\": function() {";
    echo "\n				document.eai_update_stage.submit();";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			},";
    echo "\n			\"" . Strings::LABEL_0030 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";
}

/* ================================================================================================
  fonction               :   gui_jqueryui_dialog_del_eai
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_jqueryui_dialog_del_eai() {
    // Création de Dialog (type confirmation) pour la validation de la suppression d'un EAI par un super-administrateur
    echo "\n$('#dialog_del_eai').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0029 . "\": function() {";
    echo "\n				document.eai_delete.submit();";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			},";
    echo "\n			\"" . Strings::LABEL_0030 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";
}

/* ================================================================================================
  fonction               :   gui_jqueryui_dialog_del_eai_by_manager
  description            :
  valeur(s) entrante(s)  :   $nb_user_eai =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_jqueryui_dialog_del_eai_by_manager($nb_user_eai) {
    for ($inc = 0; $inc < ((int) $nb_user_eai); $inc++) {
        // Création de Dialog (type confirmation) pour la validation de la suppression d'un EAI par un manager
        echo "\n$('#dialog_del_eai_by_manager_" . $inc . "').dialog({";
        echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
        echo "\n		buttons: {";
        echo "\n			\"" . Strings::LABEL_0029 . "\": function() {";
        echo "\n				document.eai_delete_by_manager_" . $inc . ".submit();";
        echo "\n				$(this).dialog(\"close\");";
        echo "\n			},";
        echo "\n			\"" . Strings::LABEL_0030 . "\": function() {";
        echo "\n				$(this).dialog(\"close\");";
        echo "\n			}";
        echo "\n		}";
        echo "\n});";
    }
}

/* ================================================================================================
  fonction               :   gui_jqueryui_dialog_raz_eai
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_jqueryui_dialog_raz_eai() {
    // Création de Dialog (type confirmation) pour la validation de la réouverture d'un EAI par un administrateur
    echo "\n$('#dialog_raz_eai').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0029 . "\": function() {";
    echo "\n				document.eai_status_reset.submit();";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			},";
    echo "\n			\"" . Strings::LABEL_0030 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";
}

/* ================================================================================================
  fonction               :   gui_jqueryui_dialog_confirmation_campaign
  description            :   Les fenêtres concernant les campagnes d'entretien
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_jqueryui_dialog_confirmation_campaign() {
    echo "\n$('#dialog_creation').dialog({";
    echo "\n		autoOpen: false, width: 400, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0029 . "\": function() {";
    echo "\n				document.campaign_creation.submit();";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			},";
    echo "\n			\"" . Strings::LABEL_0030 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_update').dialog({";
    echo "\n		autoOpen: false, width: 400, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0029 . "\": function() {";
    echo "\n					document.campaign_update.submit();";
    echo "\n					$(this).dialog(\"close\");";
    echo "\n			},";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_info_campaign').dialog({";
    echo "\n		autoOpen: false, width: 400, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_info_eai_user_exist').dialog({";
    echo "\n		autoOpen: false, width: 400, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_to_be_done').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_remaining').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_ongoing').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_waiting_validation').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_closed').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_to_be_done_per_manager').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_remaining_per_manager').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_ongoing_per_manager').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_waiting_validation_per_manager').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\", ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    echo "\n$('#dialog_user_eai_closed_per_manager').dialog({";
    echo "\n		autoOpen: false, width: 600, modal: true, show: \"slide\",  ";
    echo "\n		buttons: {";
    echo "\n			\"" . Strings::LABEL_0031 . "\": function() {";
    echo "\n				$(this).dialog(\"close\");";
    echo "\n			}";
    echo "\n		}";
    echo "\n});";

    gui_include_jqueryui_datepicker("datepicker_creation_start_campaign");
    gui_include_jqueryui_datepicker("datepicker_creation_end_campaign");

    gui_include_jqueryui_datepicker("datepicker_update_start_campaign");
    gui_include_jqueryui_datepicker("datepicker_update_end_campaign");
}

function gui_include_jqueryui_accordion_eai_user() {
    echo "\n$(\"#accordion_eai_user\").accordion({ header: \"h3\", active: 0, autoHeight: false,navigation: true });";
}

function gui_include_jqueryui_accordion_eai_manager() {
    echo "\n$(\"#accordion_eai_manager\").accordion({ header: \"h3\", active: 0, autoHeight: false,navigation: true });";
}

function gui_include_jqueryui_accordion_eai_hr_expert() {
    echo "\n$(\"#accordion_eai_hr_expert\").accordion({ header: \"h3\", active: 0, autoHeight: false,navigation: true });";
}

function gui_include_jqueryui_accordion_eai_admin() {
    echo "\n$(\"#accordion_eai_admin\").accordion({ header: \"h3\", active: 0, autoHeight: false,navigation: true });";
}

function gui_include_jqueryui_datepicker($name) {
    echo "\n$('#" . $name . "').datepicker({dateFormat: 'dd/mm/yy'});";
}

function gui_jqueryui_ul_open() {
    return "\n<ul id=\"icons\" class=\"ui-widget ui-helper-clearfix\">";
}

function gui_jqueryui_ul_close() {
    return "\n</ul>";
}

/* ================================================================================================
  fonction               :   gui_jqueryui_li_icon
  description            :   Les fenêtres concernant les campagnes d'entretien
  valeur(s) entrante(s)  :   $type_icon =
  $optionJS =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_jqueryui_li_icon($type_icon, $optionJS = "") {

    GLOBAL $LABEL_0037, $LABEL_0038, $LABEL_0040, $LABEL_0107, $LABEL_0108, $LABEL_0109,
    $LABEL_0125, $LABEL_0131, $LABEL_0132, $LABEL_0133, $LABEL_0134, $LABEL_0185,
    $ICON_VISUALISATION, $ICON_UPDATE, $ICON_DELETE, $ICON_VALIDATION, $ICON_ADD, $ICON_PDF, $ICON_UNLOCKED,
    $ICON_NEW_PDF, $ICON_PREVIOUS, $ICON_NEXT, $ICON_FIRST, $ICON_LAST, $ICON_SAVE, $ICON_QUIT, $ICON_REFRESH, $ICON_CSV;

    $StrReturn = "\n<li class=\"ui-state-default ui-corner-all\" ";

    switch ($type_icon) {
        case $ICON_VISUALISATION:
            $StrReturn.= "title=\"" . $LABEL_0037 . "\"><span class=\"ui-icon ui-icon-document\" " . $optionJS . " >";
            break;
        case $ICON_UPDATE :
            $StrReturn.= "title=\"" . $LABEL_0038 . "\"><span class=\"ui-icon ui-icon-wrench\" " . $optionJS . " >";
            break;
        case $ICON_DELETE :
            $StrReturn.= "title=\"" . Strings::LABEL_0039 . "\"><span class=\"ui-icon ui-icon-trash\" " . $optionJS . " >";
            break;
        case $ICON_VALIDATION :
            $StrReturn.= "title=\"" . Strings::LABEL_0007 . "\"><span class=\"ui-icon ui-icon-check\" " . $optionJS . " >";
            break;
        case $ICON_ADD :
            $StrReturn.= "title=\"" . $LABEL_0040 . "\"><span class=\"ui-icon ui-icon-plusthick\" " . $optionJS . " >";
            break;
        case $ICON_PDF :
            $StrReturn.= "title=\"" . $LABEL_0107 . "\"><span class=\"ui-icon ui-icon-script\" " . $optionJS . " >";
            break;
        case $ICON_UNLOCKED :
            $StrReturn.= "title=\"" . $LABEL_0125 . "\"><span class=\"ui-icon ui-icon-unlocked\" " . $optionJS . " >";
            break;
        case $ICON_NEW_PDF:
            $StrReturn.= "title=\"" . $LABEL_0131 . "\"><span class=\"ui-icon ui-icon-arrowthick-1-ne\" " . $optionJS . " >";
            break;
        case $ICON_PREVIOUS:
            $StrReturn.= "title=\"" . $LABEL_0109 . "\"><span class=\"ui-icon ui-icon-seek-prev\" " . $optionJS . " >";
            break;
        case $ICON_NEXT:
            $StrReturn.= "title=\"" . $LABEL_0108 . "\"><span class=\"ui-icon ui-icon-seek-next\" " . $optionJS . " >";
            break;
        case $ICON_FIRST:
            $StrReturn.= "title=\"" . $LABEL_0132 . "\"><span class=\"ui-icon ui-icon-seek-first\" " . $optionJS . " >";
            break;
        case $ICON_LAST:
            $StrReturn.= "title=\"" . $LABEL_0133 . "\"><span class=\"ui-icon ui-icon-seek-end\" " . $optionJS . " >";
            break;
        case $ICON_SAVE:
            $StrReturn.= "title=\"" . Strings::LABEL_0025 . "\"><span class=\"ui-icon ui-icon-disk\" " . $optionJS . " >";
            break;
        case $ICON_QUIT:
            $StrReturn.= "title=\"" . $LABEL_0134 . "\"><span class=\"ui-icon ui-icon-eject\" " . $optionJS . " >";
            break;
        case $ICON_REFRESH:
            $StrReturn.= "title=\"" . $LABEL_0185 . "\"><span class=\"ui-icon ui-icon-refresh\" " . $optionJS . " >";
            break;
        case $ICON_CSV:
            $StrReturn.= "title=\"" . Strings::LABEL_0201 . "\"><span class=\"ui-icon ui-icon-calculator\" " . $optionJS . " >";
            break;
        default:
            break;
    }

    $StrReturn.= "</span></li>";
    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_info_message
  description            :
  valeur(s) entrante(s)  :   $message =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_info_message($message) {
    $StrReturn = gui_div_tag_open(NULL, "ui-widget");
    $StrReturn .= gui_div_tag_open(NULL, "ui-state-highlight ui-corner-all", " margin-top: 5px; padding: 0 .7em;");
    $StrReturn .= "\n<p><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: .3em;\"></span>";
    $StrReturn .= $message . "</p>";
    $StrReturn .= gui_div_tag_close();
    $StrReturn .= gui_div_tag_close();

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_info_message
  description            :
  valeur(s) entrante(s)  :   $message =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_info_message_delayed($message, $iddiv, $delay) {
    $StrReturn = gui_div_tag_open($iddiv, "ui-widget");
    $StrReturn .= gui_div_tag_open(NULL, "ui-state-highlight ui-corner-all", " margin-top: 5px; padding: 0 .7em;");
    $StrReturn .= "\n<p><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: .3em;\"></span>";
    $StrReturn .= $message . "</p>";
    $StrReturn .= gui_div_tag_close();
    $StrReturn .= gui_div_tag_close();
    $StrReturn .= "<script type=\"text/javascript\">";
    $StrReturn .= " $(function() {";
    $StrReturn .="setTimeout(function() {";
    $StrReturn .="        $(\"#" . $iddiv . "\").hide('blind', {}, 500)";
    $StrReturn .="    }, " . $delay . ");";

    $StrReturn .="        });";
    $StrReturn .="    </script>";
    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_info_message_small
  description            :
  valeur(s) entrante(s)  :   $message =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_info_message_small($message) {
    $StrReturn = gui_div_tag_open(NULL, "ui-widget");
    $StrReturn .= gui_div_tag_open(NULL, "ui-state-highlight ui-corner-all", " margin-top: 5px; padding: 0 .7em;");
    $StrReturn .= "\n<div class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: .3em; display:inline\"></div>";
    $StrReturn .= $message . "";
    $StrReturn .= gui_div_tag_close();
    $StrReturn .= gui_div_tag_close();

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_alert_message
  description            :   Appelé lors de la génération d'une exception pour notifier une erreur ou
  une alerte.
  valeur(s) entrante(s)  :   $message =
  $type_message =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_alert_message($message, $type_message = 0) {
    Global $ERROR_MESSAGE, $ALERT_MESSAGE, $LABEL_0011;

    echo '<div id="section_box">';
    echo '<div class="ui-widget">';
    echo '<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">';
    echo '<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>';
    if ($type_message == $ERROR_MESSAGE)
        echo '<strong>' . $LABEL_0011 . ':&nbsp;</strong>';
    if ($type_message == $ALERT_MESSAGE)
        echo '<strong>' . Strings::LABEL_0012 . ':&nbsp;</strong>';

    echo $message;
    echo '<input type="button" value="Ok" style="margin-left:12px;" onclick="$(\'#section_box\').hide();">';
    echo '</p>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
}

function gui_alert_dialog($id, $text, $title = NULL) {
    ?>
    <div id="<?= $id ?>" title="<?= $title ? : Strings::LABEL_0013 ?>">
        <div class="ui-widget">
            <div class="ui-state-error ui-corner-all" style="padding:16px;font-size:1.1em;line-height:2em;">
                <span class="helper"></span>
                <div class="ui-icon ui-icon-alert" style="display:inline-block;margin-right:.3em;vertical-align:text-bottom;"></div>
                <?= $text ?>
            </div>
        </div>
    </div>
    <?php
}

/* ================================================================================================
 * 
 */

function gui_standard_link($url, $text, $textalignright = FALSE, $onclick = NULL) {
    ?>
    <div style="<?= $textalignright ? 'text-align:right;' : NULL ?>padding:8px;">
        <a class="standardlink" href="<?= ($url ? : 'javascript:void(0);') ?>"<?= ($onclick ? ' onclick="' . $onclick . '"' : NULL) ?>><?= $text ?></a>
    </div>
    <?php
}

/* ================================================================================================
  fonction               :   gui_confirm_eai_valid_dialog_box
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_confirm_eai_valid_dialog_box() {
    Global $MESSAGE_0029;

    echo gui_div_tag_open("dialog_eai_valid", NULL, NULL, Strings::LABEL_0154);
    echo gui_div_tag_open(NULL, "ui-widget");
    echo gui_div_tag_open(NULL, "ui-state-highlight ui-corner-all", "padding: 0 .7em;");
    echo "\n<p><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: .3em;\"></span>" . $MESSAGE_0029 . "</p>";
    echo gui_div_tag_close();
    echo gui_div_tag_close();
    echo gui_div_tag_close();
}

/* ================================================================================================
  fonction               :   gui_confirm_del_eai_dialog_box
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_confirm_del_eai_dialog_box() {
    Global $MESSAGE_0030;

    echo gui_div_tag_open("dialog_del_eai", NULL, NULL, Strings::LABEL_0013);
    echo gui_div_tag_open(NULL, "ui-widget");
    echo gui_div_tag_open(NULL, "ui-state-error ui-corner-all", "padding: 0 .7em;");
    echo "\n<p><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: .3em;\"></span>" . $MESSAGE_0030 . "</p>";
    echo gui_div_tag_close();
    echo gui_div_tag_close();
    echo gui_div_tag_close();
}

/* ================================================================================================
  fonction               :   gui_confirm_del_eai_by_manager
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_confirm_del_eai_by_manager($count_eai_status_1) {
    Global $MESSAGE_0030;

    for ($inc = 0; $inc < ((int) $count_eai_status_1); $inc++) {
        echo gui_div_tag_open("dialog_del_eai_by_manager_" . $inc, NULL, NULL, Strings::LABEL_0013);
        echo gui_div_tag_open(NULL, "ui-widget");
        echo gui_div_tag_open(NULL, "ui-state-error ui-corner-all", "padding: 0 .7em;");
        echo "\n<p><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: .3em;\"></span>" . $MESSAGE_0030 . "</p>";
        echo gui_div_tag_close();
        echo gui_div_tag_close();
        echo gui_div_tag_close();
    }
}

/* ================================================================================================
  fonction               :   gui_confirm_reopening_eai_dialog_box
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_confirm_raz_eai_dialog_box() {
    Global $MESSAGE_0031;

    echo gui_div_tag_open("dialog_raz_eai", NULL, NULL, Strings::LABEL_0013);
    echo gui_div_tag_open(NULL, "ui-widget");
    echo gui_div_tag_open(NULL, "ui-state-error ui-corner-all", "padding: 0 .7em;");
    echo "\n<p><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: .3em;\"></span>" . $MESSAGE_0031 . "</p>";
    echo gui_div_tag_close();
    echo gui_div_tag_close();
    echo gui_div_tag_close();
}

/* ================================================================================================
  fonction               :   gui_info_no_campaign_dialog_box
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_info_no_campaign_dialog_box() {
    Global $MESSAGE_0040;

    echo gui_div_tag_open("dialog_info_campaign", NULL, NULL, Strings::LABEL_0154);
    echo gui_div_tag_open(NULL, "ui-widget");
    echo gui_div_tag_open(NULL, "ui-state-highlight ui-corner-all", "padding: 0 .7em;");
    echo "\n<p><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: .3em;\"></span>" . $MESSAGE_0040 . "</p>";
    echo gui_div_tag_close();
    echo gui_div_tag_close();
    echo gui_div_tag_close();
}

/* ================================================================================================
  fonction               :   gui_info_eai_user_exist_in_period_campaign_dialog_box
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_info_eai_user_exist_in_period_campaign_dialog_box() {
    Global $MESSAGE_0041;

    echo gui_div_tag_open("dialog_info_eai_user_exist", NULL, NULL, Strings::LABEL_0154);
    echo gui_div_tag_open(NULL, "ui-widget");
    echo gui_div_tag_open(NULL, "ui-state-highlight ui-corner-all", "padding: 0 .7em;");
    echo "\n<p><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: .3em;\"></span>" . $MESSAGE_0041 . "</p>";
    echo gui_div_tag_close();
    echo gui_div_tag_close();
    echo gui_div_tag_close();
}

/* ================================================================================================
  fonction               :   gui_form_post_open
  description            :
  valeur(s) entrante(s)  :   Néant
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function RenderUrl($action = NULL) {
    return BASE_WWW . $action;
}

function gui_form_post_open($name, $action = "", $enctype = "") {
    $StrReturn = "\n<form action=\"" . $action . "\" method=\"post\" name=\"" . $name . "\" ";

    if ($enctype != "")
        $StrReturn .= "enctype=\"" . $enctype . "\" ";

    $StrReturn .= " >";
    return $StrReturn;
}

function gui_form_post_close() {
    return "\n</form>";
}

/* ================================================================================================
  fonction               :   gui_form_input_text_field
  description            :
  valeur(s) entrante(s)  :   $name =
  $value =
  $size =
  $maxlength =
  $id =
  $required =
  $readonly =
  $optionJS =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_input_text_field($name, $value, $size, $maxlength = NULL, $id = "", $required = false, $readonly = false, $optionJS = 0, $startBR = true) {

    GLOBAL $CHECK_CLIENT_NAME, $CHECK_DB_NAME, $CHECK_DATE, $CHECK_LOGIN, $CHECK_LOGIN_NOT_EXIST, $CHECK_EMAIL;

    $StrReturn = "";

    if ($startBR == true)
        $StrReturn .= "\n";

    $StrReturn .= "<input type=\"text\" name=\"" . $name . "\" value=\"" . $value . "\" size=\"" . $size . "\" autocomplete=\"" . AUTOCOMPLETE . "\" ";

    if ($maxlength != NULL)
        $StrReturn .= "maxlength=\"" . $maxlength . "\" ";
    if ($id != "")
        $StrReturn .= "id=\"" . $id . "\" ";
    if ($required == true)
        $StrReturn .= "required=\"true\" ";
    if ($readonly == true)
        $StrReturn .= "readonly=\"readonly\" ";
    switch ($optionJS) {
        case $CHECK_CLIENT_NAME:
            $StrReturn .= "onblur=\"javascript: checkClientName(this);\" ";
            break;
        case $CHECK_DB_NAME:
            $StrReturn .= "onblur=\"javascript: checkDBName(this);\" ";
            break;
        case $CHECK_DATE:
            $StrReturn .= "onblur=\"javascript: checkDate(this,false);\" ";
            break;
        case $CHECK_LOGIN:
            $StrReturn .= "onblur=\"javascript: checkLogin(this);\" ";
            break;
        case $CHECK_LOGIN_NOT_EXIST:// A coder en incluant en plus un appel Ajax pour vérifier en dynamique dans la BDD l'existance d'un doublon
            //$StrReturn .= "onblur=\"javascript: checkLogin(this);\" ";
            break;
        case $CHECK_EMAIL:
            $StrReturn .= "onblur=\"javascript: checkEmail(this);\" ";
            break;
        default:
            break;
    }
    $StrReturn .= "/>";

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_form_input_textarea_field
  description            :
  valeur(s) entrante(s)  :   $name =
  $value =
  $rows =
  $cols =
  $maxlength =
  $id =
  $required =
  $readonly =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_input_textarea_field($name, $value, $rows, $cols, $maxlength = NULL, $id = "", $required = false, $readonly = false) {

    $StrReturn = "\n<textarea name=\"" . $name . "\"  rows=\"" . $rows . "\" cols=\"" . $cols . "\" ";

    if ($maxlength != NULL)
        $StrReturn .= "maxlength=\"" . $maxlength . "\" ";
    if ($id != "")
        $StrReturn .= "id=\"" . $id . "\" ";
    if ($required == true)
        $StrReturn .= "required=\"true\" ";
    if ($readonly == true)
        $StrReturn .= "readonly=\"readonly\" ";

    $StrReturn .= ">";

    if ($value != NULL)
        $StrReturn .= $value;

    $StrReturn .= "</textarea>";

    return $StrReturn;
}

//============================================================================
// gui_form_textarea_text_field()
// fonction codée par autre Julien Morin
// A coder à nettoyer et fusionner avec fonction ci-dessus
//============================================================================
function gui_form_textarea_text_field($name, $value, $size, $maxlength = NULL, $id = "", $required = false, $readonly = false, $optionJS = 0) {

    GLOBAL $CHECK_CLIENT_NAME, $CHECK_DB_NAME, $CHECK_DATE, $CHECK_LOGIN, $CHECK_LOGIN_NOT_EXIST, $CHECK_EMAIL;

    $width = $size * 6;
    $height = (3 * 16);
    $StrReturn = "\n<textarea type=\"text\" name=\"" . $name . "\" size=\"" . $size . "\" autocomplete=\"" . AUTOCOMPLETE . "\" style=\"width:" . $width . "px; height:" . $height . ";\" ";

    if ($maxlength != NULL)
        $StrReturn .= "maxlength=\"" . $maxlength . "\" ";
    if ($id != "")
        $StrReturn .= "id=\"" . $id . "\" ";
    if ($required == true)
        $StrReturn .= "required=\"true\" ";
    if ($readonly == true)
        $StrReturn .= "readonly=\"readonly\" ";
    switch ($optionJS) {
        case $CHECK_CLIENT_NAME:
            $StrReturn .= "onblur=\"javascript: checkClientName(this);\" ";
            break;
        case $CHECK_DB_NAME:
            $StrReturn .= "onblur=\"javascript: checkDBName(this);\" ";
            break;
        case $CHECK_DATE:
            $StrReturn .= "onblur=\"javascript: checkDate(this,false);\" ";
            break;
        case $CHECK_LOGIN:
            $StrReturn .= "onblur=\"javascript: checkLogin(this);\" ";
            break;
        case $CHECK_LOGIN_NOT_EXIST:// A coder en incluant en plus un appel Ajax pour vérifier en dynamique dans la BDD l'existance d'un doublon
            //$StrReturn .= "onblur=\"javascript: checkLogin(this);\" ";
            break;
        case $CHECK_EMAIL:
            $StrReturn .= "onblur=\"javascript: checkEmail(this);\" ";
            break;
        default:
            break;
    }
    $StrReturn .= ">" . $value . "</textarea>";

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_form_input_file_field
  description            :
  valeur(s) entrante(s)  :   $name =
  $value =
  $size =
  $id =
  $required =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_input_file_field($name, $value, $size, $id = "", $required = false) {

    $StrReturn = "\n<input type=\"file\" name=\"" . $name . "\" value=\"" . $value . "\" size=\"" . $size . "\" autocomplete=\"" . AUTOCOMPLETE . "\" ";

    if ($id != "")
        $StrReturn .= "id=\"" . $id . "\" ";
    if ($required == true)
        $StrReturn .= "required=\"true\" ";

    $StrReturn .= "/>";

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_form_input_pwd_field
  description            :
  valeur(s) entrante(s)  :   $name =
  $value =
  $size =
  $maxlength =
  $id =
  $required =
  $readonly =
  $optionJS =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_input_pwd_field($name, $value, $size, $maxlength = NULL, $id = "", $required = false, $readonly = false, $optionJS = 0) {

    GLOBAL $CHECK_PWD_CREATION, $CHECK_PWD_UPDATE;

    $StrReturn = "\n";
    $StrReturn .= "<input type=\"password\" name=\"" . $name . "\" value=\"" . $value . "\" size=\"" . $size . "\" ";

    if ($maxlength != NULL)
        $StrReturn .= "maxlength=\"" . $maxlength . "\" ";
    if ($id != "")
        $StrReturn .= "id=\"" . $id . "\" ";
    if ($required == true)
        $StrReturn .= "required=\"true\" ";
    if ($readonly == true)
        $StrReturn .= "readonly=\"readonly\" ";
    switch ($optionJS) {
        case $CHECK_PWD_CREATION:
            $StrReturn .= "onblur=\"javascript: checkPassword(document," . $CHECK_PWD_CREATION . ");\" ";
            break;
        case $CHECK_PWD_UPDATE:
            $StrReturn .= "onblur=\"javascript: checkPassword(document," . $CHECK_PWD_UPDATE . ");\" ";
            break;
        default:
            break;
    }
    $StrReturn .= "/>";
    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_form_input_hidden_field
  description            :
  valeur(s) entrante(s)  :   $name =
  $value =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_input_hidden_field($name, $value) {
    return "\n<input type=\"hidden\" style=\"display:none;\" name=\"" . $name . "\" value=\"" . $value . "\" id=\"" . $name . "\">";
}

/* ================================================================================================
  fonction               :   gui_form_input_check_field
  description            :
  valeur(s) entrante(s)  :   $name =
  $value =
  $id =
  $checked =
  $required =
  $disabled =
  $optionJS =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_input_check_field($name, $value, $id = "", $checked = false, $required = false, $disabled = false, $optionJS = 0) {

    GLOBAL $SET_DATE_REQUIRED_EAI_CREATION, $SET_DATE_REQUIRED_EAI_UPDATE, $SET_VALUE_BIN, $SET_NAME_FILE;

    $StrReturn = "\n";

    $StrReturn .= "<input type=\"checkbox\" name=\"" . $name . "\" value=\"" . $value . "\" ";

    if ($id != "")
        $StrReturn .= "id=\"" . $id . "\" ";
    if ($required == true)
        $StrReturn .= "required=\"true\" ";
    if ($disabled == true)
        $StrReturn .= "disabled=\"disabled\" ";
    if ($checked == true)
        $StrReturn .= " checked ";
    switch ($optionJS) {
        case $SET_DATE_REQUIRED_EAI_CREATION:
            // Attention l'id doit être renseigné si cette option est activé
            $StrReturn .= "onchange=\"setDateRequired(document,'" . $id . "','datepicker_creation_start_" . $id . "', 'datepicker_creation_end_" . $id . "');(this.checked)?this.value=1:this.value=0;\" ";
            break;
        case $SET_DATE_REQUIRED_EAI_UPDATE:
            // Attention l'id doit être renseigné si cette option est activé
            $StrReturn .= "onchange=\"setDateRequired(document,'" . $id . "','datepicker_update_start_" . $id . "', 'datepicker_update_end_" . $id . "');(this.checked)?this.value=1:this.value=0;\" ";
            break;
        case $SET_VALUE_BIN:
            $StrReturn .= "onchange=\"(this.checked)?this.value=1:this.value=0;\" ";
            break;
        case $SET_NAME_FILE:
            $StrReturn .= "onchange=\"setFieldRequired(document,'" . $id . "','upload_logo_" . $id . "');(this.checked)?this.value=1:this.value=0;\" ";
            break;
        default:
            break;
    }
    $StrReturn .= "/>";

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_form_input_radio_field
  description            :
  valeur(s) entrante(s)  :   $name =
  $value =
  $id =
  $checked =
  $required =
  $disabled =
  $optionJS =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_input_radio_field($name, $value, $id, $checked = false, $required = false, $disabled = false, $optionJS = 0) {

    $StrReturn = "\n";

    $StrReturn .= "<input type=\"radio\" id=\"" . $id . "\" name=\"" . $name . "\" value=\"" . $value . "\" ";

    if ($required == true)
        $StrReturn .= "required=\"true\" ";
    if ($disabled == true)
        $StrReturn .= "disabled=\"disabled\" ";
    if ($checked == true)
        $StrReturn .= " checked ";

    $StrReturn .= "/>";

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_form_select_field
  description            :
  valeur(s) entrante(s)  :   $id =
  $name =
  $tabData : tableau à deux dimensions dont:
  -	$tabData[$inc][0] = valeur variable
  -	$tabData[$inc][1] = libellé à afficher
  $selected = variable qui spécifie la valeur selectionner en mode mise à jour
  $disabledAll =
  $disabledOne =
  $agregation = permet d'abréger des données du tableau dans les textes à afficher
  $optionJS =
  $multiple =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_form_select_field($id, $name, $tabData, $selected = "", $disabledAll = false, $disabledOne = "", $agregation = 0, $optionJS = 0, $multiple = false) {

    $StrReturn = "";

    $StrReturn .= "\n<select id=\"" . $id . "\" name=\"" . $name . "\" size=1 ";
    if ($disabledAll == true)
        $StrReturn .= "disabled=\"disabled\" ";
    if ($multiple == true)
        $StrReturn .= "multiple=\"multiple\" ";

    switch ($optionJS) {
        case 100:
            $StrReturn .= " onchange=\"javascript: load_img(); ajax_function('ajax_refresh_client_eai_template');\"";
            break;
        case 101:
            $StrReturn .= " onchange=\"javascript: load_img(); ajax_function('ajax_refresh_manager_campaign');\"";
            break;
        default:
            break;
    }

    $StrReturn .= ">";

    $StrReturn .= gui_form_select_options($tabData, $selected, $disabledOne, $agregation);

//    for ($inc = 0, $stop = (count($tabData) - 1); $inc < $stop; $inc++) {
//        $StrReturn .= "<option value=\"" . $tabData[$inc][0] . "\" ";
//        if ($selected != "" && $selected == $tabData[$inc][0])
//            $StrReturn .= "selected ";
//        if ($disabledOne != "" && $disabledOne == $tabData[$inc][0])
//            $StrReturn .= "disabled=\"disabled\"  ";
//
//        $StrReturn .= ">" . $tabData[$inc][1];
//        if ($agregation != 0) {
//            for ($inc2 = 2; $inc2 < (2 + $agregation); $inc2++)
//                $StrReturn .= " - " . $tabData[$inc][$inc2];
//        }
//        $StrReturn .= "</option>";
//    }

    $StrReturn .= "</select>";

    return $StrReturn;
}

function gui_form_select_options($tabData, $selected = "", $disabledOne = "", $agregation = 0) {
    $StrReturn = "";

    for ($inc = 0, $stop = (count($tabData) - 1); $inc < $stop; $inc++) {
        $StrReturn .= "<option value=\"" . $tabData[$inc][0] . "\" ";
        if ($selected != "" && $selected == $tabData[$inc][0])
            $StrReturn .= "selected ";
        if ($disabledOne != "" && $disabledOne == $tabData[$inc][0])
            $StrReturn .= "disabled=\"disabled\"  ";

        $StrReturn .= ">" . $tabData[$inc][1];
        if ($agregation != 0) {
            for ($inc2 = 2; $inc2 < (2 + $agregation); $inc2++)
                $StrReturn .= " - " . $tabData[$inc][$inc2];
        }
        $StrReturn .= "</option>";
    }

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_img_tag
  description            :
  valeur(s) entrante(s)  :   $src =
  $title =
  $width =
  $height =
  $class =
  $id =
  $style =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_img_tag($src, $title = NULL, $width = NULL, $height = NULL, $class = NULL, $id = NULL, $style = NULL) {
    $StrReturn = "\n<img ";
    if ($src != NULL)
        $StrReturn .= "src=\"" . $src . "\" ";
    if ($title != NULL)
        $StrReturn .= "title=\"" . $title . "\" ";
    if ($width != NULL)
        $StrReturn .= "width=\"" . $width . "\" ";
    if ($height != NULL)
        $StrReturn .= "height=\"" . $height . "\" ";
    if ($class != NULL)
        $StrReturn .= "class=\"" . $class . "\" ";
    if ($id != NULL)
        $StrReturn .= "id=\"" . $id . "\" ";
    if ($style != NULL)
        $StrReturn .= "style=\"" . $style . "\" ";
    $StrReturn .= "/>";
    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_font_tag
  description            :
  valeur(s) entrante(s)  :   $class =
  $text =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_font_tag($class, $text, $endBR = true) {
    echo "\n<font class=" . $class . ">";
    if (strcmp($class, "titre_1") == 0)
        echo "<br/>";
    echo $text;
    if (strcmp($class, "titre_1") == 0)
        echo "<br/>";
    if ($endBR == true) {
        echo "<br/></font>";
    } else {
        echo "</font>";
    }
}

/* ================================================================================================
  fonction               :   gui_div_tag_open
  description            :
  valeur(s) entrante(s)  :   $id =
  $class =
  $style =
  $title =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_div_tag_open($id = NULL, $class = NULL, $style = NULL, $title = NULL) {

    $StrReturn = "\n<div";
    if ($id != NULL)
        $StrReturn .= " id=\"" . $id . "\" ";
    if ($class != NULL)
        $StrReturn .= " class=\"" . $class . "\" ";
    if ($style != NULL)
        $StrReturn .= " style=\"" . $style . "\" ";
    if ($title != NULL)
        $StrReturn .= " title=\"" . $title . "\" ";
    $StrReturn .= ">";
    return $StrReturn;
}

function gui_div_tag_close() {
    return "\n</div> ";
}

/* ================================================================================================
  fonction               :   gui_table_tag_open
  description            :
  valeur(s) entrante(s)  :   $width =
  $cellpadding =
  $cellspacing =
  $border =
  $class =
  $id =
  $style =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_table_tag_open($width = "100%", $cellpadding = 0, $cellspacing = 0, $border = 0, $class = NULL, $id = NULL, $style = NULL) {
    $StrReturn = "";
    $StrReturn .= "\n<table style=\"";
    if ($width != NULL)
        $StrReturn .= " width:$width; ";
    if ($border != NULL)
        $StrReturn .= " border: solid " . $border . "px black; ";
    if ($style != NULL)
        $StrReturn .= " $style ";
    $StrReturn .= "\" ";

    $StrReturn .= " cellpadding=\"" . $cellpadding . "\" cellspacing=\"" . $cellspacing . "\" ";
    if ($class != NULL)
        $StrReturn .= "class=\"" . $class . "\" ";
    if ($id != NULL)
        $StrReturn .= "id=\"" . $id . "\" ";
    $StrReturn .= ">";

    return $StrReturn;
}

function gui_table_tag_close() {
    return "\n</table>";
}

/* ================================================================================================
  fonction               :   gui_tr_tag_open
  description            :
  valeur(s) entrante(s)  :   $align =
  $valign =
  $class =
  $id =
  $style =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_tr_tag_open($align = NULL, $valign = NULL, $class = NULL, $id = NULL, $style = NULL) {
    $StrReturn = "\n<tr style=\"";
    if ($align != NULL)
        $StrReturn .= " text-align:\"" . $align . "\"; ";
    if ($valign != NULL)
        $StrReturn .= " vertical-align:\"" . $valign . "\"; ";
    if ($style != NULL)
        $StrReturn .= " $style ";
    $StrReturn .= "\"";

    if ($class != NULL)
        $StrReturn .= " class=\"" . $class . "\" ";
    if ($id != NULL)
        $StrReturn .= " id=\"" . $id . "\" ";
    $StrReturn .= ">";

    return $StrReturn;
}

function gui_tr_tag_close() {
    return "\n</tr>";
}

/* ================================================================================================
  fonction               :   gui_tr_tag_empty
  description            :   Créer un nb paramétrable de ligne vide dans un tableau pour créer des espaces
  valeur(s) entrante(s)  :   $nb =
  $colspan =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_tr_tag_empty($nb, $colspan) {
    $StrReturn = "";
    for ($inc = 0; $inc < $nb; $inc++) {
        $StrReturn .= gui_tr_tag_open();
        $StrReturn .= gui_td_tag("&nbsp;<br/>", NULL, NULL, NULL, $colspan, NULL, NULL, NULL, NULL);
        $StrReturn .= gui_tr_tag_close();
    }
    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_th_tag
  description            :
  valeur(s) entrante(s)  :   $data =
  $width =
  $align =
  $valign =
  $colspan =
  $rowspan =
  $class =
  $id =
  $style =
  $title =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_th_tag($data, $width = NULL, $align = NULL, $valign = NULL, $colspan = NULL, $rowspan = NULL, $class = NULL, $id = NULL, $style = NULL, $title = NULL) {
    $StrReturn = "\n<th style=\"";
    if ($width != NULL)
        $StrReturn .= " width:$width; ";
    if ($align != NULL)
        $StrReturn .= " text-align:$align; ";
    if ($valign != NULL)
        $StrReturn .= " vertical-align:$valign; ";
    if ($style != NULL)
        $StrReturn .= " $style ";
    $StrReturn .= "\"";

    if ($colspan != NULL)
        $StrReturn .= " colspan=\"" . $colspan . "\" ";
    if ($rowspan != NULL)
        $StrReturn .= " rowspan=\"" . $rowspan . "\" ";
    if ($class != NULL)
        $StrReturn .= " class=\"" . $class . "\" ";
    if ($id != NULL)
        $StrReturn .= " id=\"" . $id . "\" ";
    if ($title != NULL)
        $StrReturn .= " title=\"" . $title . "\" ";
    $StrReturn .= ">";

    $StrReturn .= $data . "</th>";

    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_td_tag
  description            :
  valeur(s) entrante(s)  :   $data =
  $width =
  $align =
  $valign =
  $colspan =
  $rowspan =
  $class =
  $id =
  $style =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_td_tag($data, $width = NULL, $align = NULL, $valign = NULL, $colspan = NULL, $rowspan = NULL, $class = NULL, $id = NULL, $style = NULL) {
    $StrReturn = "\n<td style=\" ";
    if ($width != NULL)
        $StrReturn .= " width:$width; ";
    if ($align != NULL)
        $StrReturn .= " text-align:$align; ";
    if ($valign != NULL)
        $StrReturn .= " vertical-align:$valign; ";
    if ($style != NULL)
        $StrReturn .= " $style; ";
    $StrReturn .= "\" ";

    if ($colspan != NULL)
        $StrReturn .= " colspan=\"" . $colspan . "\" ";
    if ($rowspan != NULL)
        $StrReturn .= " rowspan=\"" . $rowspan . "\" ";
    if ($class != NULL)
        $StrReturn .= " class=\"" . $class . "\" ";
    if ($id != NULL)
        $StrReturn .= " id=\"" . $id . "\" ";
    $StrReturn .= ">";
    $StrReturn .= $data . "</td>";
    return $StrReturn;
}

/* ================================================================================================
  fonction               :   gui_td_tag_open
  description            :
  valeur(s) entrante(s)  :   $width =
  $align =
  $valign =
  $colspan =
  $rowspan =
  $class =
  $id =
  $style =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_td_tag_open($width = NULL, $align = NULL, $valign = NULL, $colspan = NULL, $rowspan = NULL, $class = NULL, $id = NULL, $style = NULL) {
    $StrReturn = "\n<td style=\"";
    if ($width != NULL)
        $StrReturn .= " width:$width; ";
    if ($align != NULL)
        $StrReturn .= " text-align:$align; ";
    if ($valign != NULL)
        $StrReturn .= " vertical-align:$valign; ";
    if ($style != NULL)
        $StrReturn .= " $style; ";
    $StrReturn .= "\" ";

    if ($colspan != NULL)
        $StrReturn .= " colspan=\"" . $colspan . "\" ";
    if ($rowspan != NULL)
        $StrReturn .= " rowspan=\"" . $rowspan . "\" ";
    if ($class != NULL)
        $StrReturn .= " class=\"" . $class . "\" ";
    if ($id != NULL)
        $StrReturn .= " id=\"" . $id . "\" ";
    $StrReturn .= ">";
    return $StrReturn;
}

function gui_td_tag_close() {
    return "\n</td>";
}

/* ================================================================================================
  fonction               :   gui_bottom_page
  description            :
  valeur(s) entrante(s)  :   $page =
  valeur(s) sortante(s)  :   Néant
  ================================================================================================ */

function gui_bottom_page() {

    require_once 'Twig/Autoloader.php';
    Twig_Autoloader::register();
    $loader = new Twig_Loader_Filesystem('app/views/templates');
    $twig = new Twig_Environment($loader);

    // OBSOLETE

    require 'app/views/shared/footer.php';

    echo "\n</body>";
    echo "\n</html>";
}
